package com.leyou.auth.local;

import com.leyou.auth.dto.UserDetails;

/**
 * @author 虎哥
 */
public class UserContext {
    private final static ThreadLocal<UserDetails> tl = new ThreadLocal<>();
    private final static ThreadLocal<String> jwtTL = new ThreadLocal<>();

    public static void setJwt(String jwt){
        jwtTL.set(jwt);
    }
    public static String getJwt(){
        return jwtTL.get();
    }
    public static void removeJwt(){
        jwtTL.remove();
    }

    public static void setUser(UserDetails user){
        tl.set(user);
    }

    public static UserDetails getUser(){
        return tl.get();
    }

    public static void removeUser(){
        tl.remove();
    }
}
